home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softdisk Supreme
/
Softdisk Supreme.iso
/
pc
/
DSK Files
/
0-49
/
SD005b.dsk
/
CONVERTER.bas
< prev
next >
Wrap
BASIC Source File
|
2003-06-12
|
7KB
|
221 lines
0 CLEAR
10 TEXT
20 GOSUB 270: REM ** ERROR HANDLING **
30 GOTO 1830: REM ** MAIN PROGRAM **
40 DIM A(8,8)
50 RESTORE
60 FOR I = 1 TO 8
70 FOR J = 1 TO 8
80 READ A(I,J)
90 NEXT J,I
100 DATA 1,.1,1.0E-3,1.0E-6
110 DATA 3.937007874E-2,3.28039895E-3,1.093612102E-3,6.213700339E-7
120 DATA 10,1,1.0E-2,1.0E-5
130 DATA 3.937007874E-1,3.280839895E-2,1.093612102E-2,6.213700339E-6
140 DATA 1.0E3,1.0E2,1,1.0E-3
150 DATA 3.937007874E1,3.280839895,1.093612102,6.213700339E-4
160 DATA 1.0E6,1.0E5,1.0E3,1
170 DATA 3.937007874E4,3.280839895E3,1.093612102E3,6.213700339E-1
180 DATA 2.54E1,2.54,2.54E-2,2.54E-5
190 DATA 1, 8.333333333E-2,2.777777778E-2,1.578282828E-5
200 DATA 3.048E2,3.048E1,3.048E-1,3.048E-4
210 DATA 1.2E1,1,3.333333333E-1,1.893939394E-4
220 DATA 9.14401E2,9.14401E1,9.14401E-1,9.14401E-4
230 DATA 3.6E1,3.0,1,5.681818182E-4
240 DATA 1.609347E6,1.609347E5,1.609347E3,1.609347
250 DATA 6.3360E4,5.280E3,1.760E3,1
260 RETURN
270 REM ** ERROR HANDLING ROUTINE **
280 POKE 768,104: POKE 769,168: POKE 770,104: POKE 771,166: POKE 772,223: POKE 773,154: POKE 774,72: POKE 775,152: POKE 776,72: POKE 777,96
290 RETURN
300 REM ** UNITS **
310 U1$ = "MILLIMETERS"
320 U2$ = "CENTIMETERS"
330 U3$ = "METERS"
340 U4$ = "KILOMETERS"
350 U5$ = "INCHES"
360 U6$ = "FEET"
370 U7$ = "YARDS"
380 U8$ = "MILES"
390 RETURN
400 REM ** ASSIGN B **
410 IF B = 1 THEN O$ = U1$
420 IF B = 2 THEN O$ = U2$
430 IF B = 3 THEN O$ = U3$
440 IF B = 4 THEN O$ = U4$
450 IF B = 5 THEN O$ = U5$
460 IF B = 6 THEN O$ = U6$
470 IF B = 7 THEN O$ = U7$
480 IF B = 8 THEN O$ = U8$
490 RETURN
500 REM ** ASSIGN Q **
510 IF Q = 1 THEN D$ = U1$
520 IF Q = 2 THEN D$ = U2$
530 IF Q = 3 THEN D$ = U3$
540 IF Q = 4 THEN D$ = U4$
550 IF Q = 5 THEN D$ = U5$
560 IF Q = 6 THEN D$ = U6$
570 IF Q = 7 THEN D$ = U7$
580 IF Q = 8 THEN D$ = U8$
590 RETURN
600 REM ** END PROGRAM **
610 HOME
620 F = FRE(1): IF F <0 THEN F = 65536 +F
630 PRINT : PRINT "LENGTH CONVERTER ";F;" BYTES LEFT": END
640 REM ** SET TABS **
650 T = 1: REM TEXT
660 P = 18: REM HOW MANY
670 M = 9: REM CATALOG
680 V = 16: REM CONV TAB
690 K = 14: REM LOADING DATA
700 RETURN
710 REM ** CATALOG **
720 HOME
730 HTAB T: VTAB T
740 PRINT "PICK ANY COMBINATION BY NUMBER "
750 HTAB T: PRINT
760 PRINT "SEPARATE NUMBERS BY A -"
770 PRINT : PRINT
780 PRINT TAB( M);"1...MILLIMETERS(MM)"
790 PRINT TAB( M);"2...CENTIMETERS(CM)"
800 PRINT TAB( M);"3...METERS(M)"
810 PRINT TAB( M);"4...KILOMETERS(KM)"
820 PRINT TAB( M);"5...INCHES(IN.)"
830 PRINT TAB( M);"6...FEET(FT.)"
840 PRINT TAB( M);"7...YARDS(YDS.)"
850 PRINT TAB( M);"8...MILES(MI.)"
860 PRINT TAB( M);"9...QUIT"
870 VTAB V: HTAB T
880 PRINT "CONVERT FROM WHAT TO WHAT ";
890 RETURN
900 VTAB P: HTAB T: PRINT "HOW MANY ";D$;: RETURN
910 REM ** LOADING DATA **
920 HOME
930 VTAB 10: HTAB K
940 PRINT " READING DATA"
950 RETURN
960 REM ** PRINT RESULT **
970 PRINT
980 PRINT H;" ";D$" = ";MO;" ";O$
990 RETURN
1000 REM ** ADDITIONAL CONVERSIONS **
1010 PRINT
1020 PRINT TAB( T);"DO YOU WANT ANOTHER"
1030 PRINT TAB( T);"CONVERSION WITH THE SAME UNITS (Y/N)? ";: RETURN
1040 PRINT C$: RETURN
1050 REM ** ERROR MESSAGE **
1060 FOR I = 1 TO 500
1070 VTAB P: FLASH : PRINT "INVALID ENTRY"
1080 NEXT I
1090 NORMAL
1100 RETURN
1110 REM ** INPUT ROUTINES **
1120 INPUT " ";C$: RETURN
1130 INPUT " ";H$: RETURN
1140 GET AN$: RETURN
1150 REM ** INPUT ERROR DETECTION **
1160 IF B *Q <1 OR B >9 OR Q >9 THEN GOSUB 1050: GOTO 2000
1170 IF LEN(C$) < >3 THEN GOSUB 1050: GOTO 2000
1180 IF ASC( MID$ (C$,2,1)) < >45 THEN GOSUB 1050: GOTO 2000
1190 RETURN
1200 REM ** H$ ERROR & FRACTION **
1210 IF H$ = "" THEN GOSUB 1510: GOTO 2080
1220 P1 = 0
1230 S = 0
1240 E = 0
1250 W = LEN(H$)
1260 FOR K = 1 TO W
1270 FF$ = MID$ (H$,K,1)
1280 X = ASC(FF$)
1290 IF X = 69 OR X = 43 THEN 1310
1300 IF X <45 OR X >57 THEN GOSUB 1510: GOTO 2080
1310 REM ** NOS.BETWEEN 45-57**
1320 REM ** TEST FOR FALSE BEGININGS **
1330 IF K = 1 AND X <46 THEN GOSUB 1510: GOTO 2080
1340 IF K = 1 AND X >57 THEN GOSUB 1510: GOTO 2080
1350 IF K = W AND X <46 THEN GOSUB 1510: GOTO 2080
1360 IF K = W AND X >57 THEN GOSUB 1510: GOTO 2080
1370 IF K = 1 AND X = 47 THEN GOSUB 1510: GOTO 2080
1380 IF K = W AND X = 47 THEN GOSUB 1510: GOTO 2080
1390 IF K >1 AND K <W THEN YM$ = MID$ (H$,K -1,1):YM = ASC(YM$)
1400 IF K >1 AND K <W AND (X = 45 OR X = 43) AND YM < >69 THEN GOSUB 1510: GOTO 2080
1410 IF X = 47 OR X = 175 THEN S = S +1
1420 IF X = 69 OR X = 197 THEN E = E +1
1430 IF X = 46 OR X = 174 THEN P1 = P1 +1
1440 REM * CHECK FOR TO MANY E S*
1450 IF P1 >1 THEN GOSUB 1510: GOTO 2080
1460 IF E >1 THEN GOSUB 1510: GOTO 2080
1470 IF S >1 THEN GOSUB 1510: GOTO 2080
1480 NEXT K
1490 RETURN
1500 REM ** H$ ERROR CORRECTION **
1510 GOSUB 1050: GOSUB 710: GOSUB 1040
1520 RETURN
1530 REM ** ERROR CORRECTION **
1540 CALL 768: GOSUB 1510: GOTO 2080
1550 REM ** MANIPULATE C$ **
1560 Q$ = LEFT$(C$,2)
1570 B$ = RIGHT$(C$,2)
1580 Q = VAL(Q$)
1590 B = ABS( VAL(B$))
1600 RETURN
1610 REM ** CHECK FOR FRACTIONS & CALC. H **
1620 I = 0
1630 F$ = "/"
1640 L = LEN(H$)
1650 I = I +1
1660 FF$ = MID$ (H$,I,1)
1670 IF FF$ = F$ THEN 1690
1680 IF I <L AND FF$ < >F$ THEN 1650
1690 VF$ = LEFT$(H$,I -1)
1700 VF = VAL(VF$)
1710 LF$ = RIGHT$(H$,L -I)
1720 LF = VAL(LF$)
1730 IF LF = 0 THEN GOSUB 1510: GOTO 2080
1740 H = VF/LF
1750 RETURN
1760 REM ** H$ VALUE NO FRACTION **
1770 H = VAL(H$)
1780 RETURN
1790 REM ** CALCULATION FOR H & MO **
1800 MO = H *(A(Q,B))
1810 RETURN
1820 REM ***********************
1830 REM ** LENGTH CONVERSIONS **
1840 REM ** ENGLISH TO METRIC **
1850 REM ** METRIC TO ENGLISH **
1860 REM ** METRIC TO METRIC **
1870 REM ** ENGLISH TO ENGLISH **
1880 REM ** FRACTIONS ALLOWED **
1890 REM *****************************
1900 REM ** BY A.STEPHEN GALLAGHER **
1910 REM ** GOETHESTRASSE 25 **
1920 REM ** D 5200 SIEGBURG **
1930 REM ** WEST GERMANY **
1940 REM ** (02241)50484 **
1950 REM ** 28 AUGUST 1979 **
1960 REM ******************************
1970 GOSUB 640: REM SET TABS
1980 GOSUB 910: REM PRINT LOADING
1990 GOSUB 40: REM LOADING DATA
2000 GOSUB 710: REM CATALOG
2010 GOSUB 1120: REM INPUT WHAT
2020 GOSUB 1550: REM FIND B,Q
2030 GOSUB 300: REM DEFINE U$
2040 GOSUB 500: REM ASSIGN Q
2050 GOSUB 400: REM ASSIGN B
2060 IF Q = 9 OR B = 9 THEN GOTO 600: REM END
2070 GOSUB 1150: REM TEST INPUT
2080 GOSUB 900: REM HOW MANY
2090 GOSUB 1130: REM INPUT
2100 ONERR GOTO 1530
2110 GOSUB 1200: REM TEST INPUT
2120 IF S = 1 THEN GOSUB 1610: GOTO 2140
2130 GOSUB 1760: REM VALUE H$
2140 GOSUB 1790: REM CALC. H & MO
2150 GOSUB 960: REM PRINT RESULT
2160 GOSUB 1000: REM ANOTHER?
2170 GOSUB 1140: REM GET Y/N
2180 IF AN$ = "N" THEN 2000
2190 IF AN$ = "Y" THEN GOSUB 710: GOSUB 1040: GOTO 2080
2200 GOTO 2170